<div id="ppQuestion" class="reveal-modal" style="display:none;">
    <div class="wrap-pp wrap-Question">
        <h4>Send et spørgsmål til dette produkt</h4>
        <div class="QRight">
            <h5>Telefontider alle ugens 7 dage</h5>
            <p class="phone">Tlf. 4830 1699</p>
            <p><label> Mandag – fredag </label> <span>10.00-17-30</span> </p>
            <p><label>Lørdag</label> <span>10.00-16.00</span> </p>
            <p><label>Søndag</label> <span>11.00-16.00</span> </p>
        </div>
        <div class="QLeft">
            <form id="send_question" action="<?php echo $action ?>" method="post" enctype="multipart/form-data">
                <p><i>Felter markeret med * skal udfyldes</i></p>
                <input type="text" id="client_name" class="txtInput" name="client_name" placeholder="Navn*:"/>
                <input type="text" id="client_phone" class="txtInput" name="client_phone" placeholder="Tlf:"/>
                <input type="text" id="client_email" class="txtInput" name="client_email" placeholder="Email*:"/>
                <textarea id="client_comment" class="txtArea" name="client_comment" placeholder="Skriv dit spørgsmål her*:"></textarea>
                <input type="hidden" id="product_link" class="product_link" name="product_link" />

                <a id="send_question_email" class="btn btnSend" href="javascript:void(0);" onclick="sendQuestionEmail();">Send</a>
            </form>
        </div>

        <p id="send_question_form_error" style="display:none; clear:both;"></p>
    </div>
    <!--wrap-nyhedsbrev-->

    <!-- a class="close-reveal-modal">&#215;</a -->
</div>
<!--#ppQuestion-->

<script type="text/javascript">
    var mail_filter_qf = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,6})+$/;

    function sendQuestionEmail(){
        var msg_qf = '';
        var error = false;

        if($('#client_name').val() == ''){
            error = true;
            $('#client_name').addClass('errorField');
            msg_qf = 'Ugyldigt navn';
        }
        else{
            if($('#client_name').hasClass('errorField')){
                $('#client_name').removeClass('errorField');
            }
            error = false;
        }

        if(!error){
            if(($('#client_email').val() == '') || !mail_filter_qf.test($('#client_email').val())){
                error = true;
                $('#client_email').addClass('errorField');
                if(msg_qf == ''){
                    msg_qf = 'Indtast venligst en gyldig e-mail adresse';
                }
            }
            else{
                if($('#client_email').hasClass('errorField')){
                    $('#client_email').removeClass('errorField');
                }
                error = false;
            }
        }

        if(!error){
            if($('#client_comment').val() == ''){
                error = true;
                $('#client_comment').addClass('errorField');
                if(msg_qf == ''){
                    msg_qf = 'Ugyldigt "Skriv dit spørgsmål her"';
                }
            }
            else{
                if($('#client_comment').hasClass('errorField')){
                    $('#client_comment').removeClass('errorField');
                }
                error = false;
            }
        }

        if(error){
            $('#send_question_form_error').html('<h3>' + msg_qf + '</h3>');
        }
        else {
            $('#send_question_form_error').html('');

            $.ajax({
                type: 'post',
                url: '<?php echo $send; ?>',
                dataType: 'html',
                data: {
                    'client_name': $('#client_name').val(),
                    'client_phone': $('#client_phone').val(),
                    'client_email': $('#client_email').val(),
                    'client_comment': $('#client_comment').val(),
                    'product_link': $('#product_link').val()
                },
                success: function(html){
                    $('#ppQuestion .QLeft').html('<h3 style="margin-top:20px; color:#000; font-weight:bold; text-transform:none;">' + html + '</h3>');
                    //$('a.fancybox-close').trigger('click');
                },
                complete: function(){
                }
            });
        }
    }
</script>